<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<script type="text/javascript">
var payRadio;
   $(document).ready(function(){
      var result1=0;
       $(":input[name=moneyPay]").click(function(){ 
         payRadio=$(this).val();
         if(payRadio=="60000"){
            $("#priceWithTaxView").html("");
            var selfView="<input type=text name=moneyPayText placeholder=직접입력>";
            $("#selfInsertView").html(selfView);
            $("#selfInsertView").on("keyup",":input[name=moneyPayText]",function(){
               result1=   $(":input[name=moneyPayText]").val();
                $.ajax({
                  type:"POST",
                  url:"${initParam.root}member/reChargeMoneyPrice1.moja",
                  data:"memberMoneyText="+$(":input[name=moneyPayText]").val(),
                  success:function(jsonData){
                     //alert(jsonData);
                     if(result1>=60000){
                        $("#selfCheckView").html("입력 가능한 가격입니다").css("background","yellow");      
                        }else{
                           $("#selfCheckView").html("60000원이상 입력해야 합니다").css("background","gray");                  
                        }
                     
                     var view="";
                     view="총 결제할 금액: "+jsonData+"원  (세금20% 포함)";
                     $("#priceWithTaxView").html("<h2>"+view+"</h2>");
                     
                     //result1=jsonData;
                  }
               });//ajax 
            });
                  
         }else{
            $("#selfInsertView").html("");
            $("#selfCheckView").html("");
            
            $.ajax({
               type:"POST",
               url:"${initParam.root}member/reChargeMoneyPrice.moja",
               data:"memberMoney="+payRadio,
               success:function(jsonData){
                  var view="";
                  view="총 결제할 금액: "+jsonData+"원  (세금20% 포함)";
                  $("#priceWithTaxView").html("<h2>"+view+"</h2>");
                  //result1=jsonData;
               }
            });//ajax
            result1=payRadio;
         }//else
         
               
      });    
       
       $(":input[name=updateRechargeBtn]").click(function(){ 
        if(confirm("충전하시겠습니까?")){
           if(payRadio==60000 && result1<=59999){
              alert("60000원 이상 입력해주세요");
           }else{
              location.href="${initParam.root }member/updateRecharge.moja?memberId=${sessionScope.mvo.memberId }&result1="+result1;
           }      
         } 
 	  });  //updateclick
   });//ready
   
    
       
       
   
   
</script>
<div id="mainCss">
<h1>충전/결제</h1>
<hr>
<b>${sessionScope.mvo.memberName }(${sessionScope.mvo.memberId } )님의 계좌내역</b><br><br>
<b>충전금: <b>${sessionScope.mvo.memberMoney } 원<br>
<b>포인트: <b>${sessionScope.mvo.memberPoint } 점
<br><br><br>
<h3>충전금액선택</h3>
<hr>
<br>
<form id="payForm" method="post">
   5000원<input type="radio" name="moneyPay" value="5000"> &nbsp;  &nbsp;  &nbsp;  &nbsp;
   10000원<input type="radio" name="moneyPay" value="10000">&nbsp;  &nbsp;  &nbsp;  &nbsp;
   20000원<input type="radio" name="moneyPay" value="20000"><br><br>
   30000원<input type="radio" name="moneyPay" value="30000"> &nbsp;  &nbsp;  &nbsp;  &nbsp;
   40000원<input type="radio" name="moneyPay" value="40000">&nbsp;  &nbsp;  &nbsp;  &nbsp;
   50000원<input type="radio" name="moneyPay" value="50000"><br><br>
   60000원 이상<input type="radio" name="moneyPay" value="60000" >
   <span id="selfInsertView"></span><div id="selfCheckView"></div>
</form>
<hr>
<hr>
<div id="priceWithTaxView">
</div>

<input type="button" name="updateRechargeBtn" value="충전하기" class="login_button">

</div>
 <%-- <form method="post" action="${initParam.root }member/updateRecharge.moja">
   <input type="hidden" name="memberId1" value="${sessionScope.mvo.memberId }">
   <input type="hidden" name="memberMoney1" value="result">
   <input type="submit" value="충전하기" class="login_button">
</form>  --%>
<%-- <a href="${initParam.root }member/updateRecharge.moja?memberId1=${sessionScope.mvo.memberId }&result1=result1">aaa</a> --%>

<%-- <a href="${initParam.root }member/updateRecharge.moja?memberId="+${sessionScope.mvo.memberId }+"&memberMoney="+result >충전하기</a> --%>